Reversible Processes
It must be emphasized the the force (or pressure) given in the work formula is the force of the molecules (the system) on the piston. In the piston-cylinder apparatus there are two relevant pressures, or forces, acting on the piston: (1) the "external" pressure applied to the piston, and which in the applet can be adjusted to any value with the slider; and (2) the "internal" pressure exerted by the molecules on the piston as they continually bounce off of it. At equilibrium, these two pressures are equal and the piston undergoes no net motion. When this balance is altered by changing the external pressure via the slider, decreasing it for example, the piston accelerates and the system volume increases. In a reversible process, the imbalance of forces is small. Consequently the acceleration of the piston is small also and it acquires little momentum. In the reversible process, all the work performed by the system in pushing up the piston goes into the potential energy of the piston mass and the process operates as efficiently as it can. In contrast, in an irreversible expansion there is significant imbalance of the external and internal forces, and the piston acquires some kinetic energy. As the piston rises and ultimately falls back down again, this energy is returned to the molecules, tending to raise the system temperature. In response, heat flows out of the system, and this lost energy represents an inefficiency in the process.
Note that the irreversibility arises without introducing friction into the process. In the applet, piston friction is not included in the model, so no energy is lost there. Any losses are entirely a consequence of the imbalance of the system with its surroundings.